GtkMenuItem: fix display of accelerators
authorMatthias Clasen <mclasen@redhat.com>
Sun, 20 Jul 2014 04:12:40 +0000 (00:12 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 20 Jul 2014 04:12:40 +0000 (00:12 -0400)
The accel label in menus was getting a small allocation that
caused its draw code to always omit the accelerator string.
Fix that by setting halign to fill. To keep the menu label
left-aligned, set xalign to 0 to compensate.

gtk/gtkmenuitem.c

index cffd25aba6f08d7eba14f3b9d6c9f5ad1dedc63c..67c90e29510b4308df4480aeed3d9ad50ad27997 100644 (file)
@@ -2510,8 +2510,8 @@ gtk_menu_item_ensure_label (GtkMenuItem *menu_item)
 
   if (!gtk_bin_get_child (GTK_BIN (menu_item)))
     {
-      accel_label = g_object_new (GTK_TYPE_ACCEL_LABEL, NULL);
-      gtk_widget_set_halign (accel_label, GTK_ALIGN_START);
+      accel_label = g_object_new (GTK_TYPE_ACCEL_LABEL, "xalign", 0.0, NULL);
+      gtk_widget_set_halign (accel_label, GTK_ALIGN_FILL);
       gtk_widget_set_valign (accel_label, GTK_ALIGN_CENTER);
 
       gtk_container_add (GTK_CONTAINER (menu_item), accel_label);